﻿using Daemon.Model;
using Microsoft.AspNetCore.Mvc;
using Daemon.Repository.Contract;
using System.Net.Http;
using Microsoft.AspNetCore.Http;
using Daemon.Common;
using System.Net;
using Daemon.Service.Contract;

namespace DaemonAPI
{
	[ApiController]
	[Route("api/[controller]/[action]")]
	public class TakeAwayUserExchangeController : BaseApiController<TakeAwayUserExchange, ITakeAwayUserExchangeRepository>
	{
		private readonly ITakeAwayUserExchangeService _takeAwayUserExchangeService;

		public TakeAwayUserExchangeController(ITakeAwayUserExchangeRepository repository, IHttpContextAccessor httpContextAccessor, ITakeAwayUserExchangeService takeAwayUserExchangeService) : base(repository, httpContextAccessor)
		{
			_takeAwayUserExchangeService = takeAwayUserExchangeService;
		}


		[HttpPost]
		[Route("")]
		public ResultModel Exchange(int userId, string address, int goodId, int typeId, int count, int shopId)
		{
			return new ResultModel(HttpStatusCode.OK, "", _takeAwayUserExchangeService.Exchange(userId, address, goodId, typeId, count, shopId));
		}
	}
}
